package com.bysc.commonutils.constant;

public class RedisConstant {

    public static final String _LIKE = "like";
    public static final String _COLLECT = "collect";
    public static final String _VIEW = "view";

    /**
     * minio定期删除垃圾文件
     * set:FILE_URL_DB_RESOURCES 文件的所有文件url（minio）
     * set:FILE_URL_RESOURCES 文件保存在数据库中的文件url（数据库）
     */
    public static final String FILE_URL_DB_RESOURCES = "file_url_db_resources";
    public static final String FILE_URL_RESOURCES = "file_url_resources";

    /**
     * 录取单结果
     * string：SMS_PHONE+uid code
     */
    public static final String JOIN_FORM = "join:form:";

    /**
     * 手机短信验证码
     * string：SMS_PHONE+phone code
     */
    public static final String SMS_PHONE = "sms:phone:";

    /**
     * 邮箱验证码
     * string：EMAIL+email code
     */
    public static final String EMAIL = "email:";

    /**
     * 评论/学习资料点赞与收藏排行榜
     * hash：COMMENT_POST+id LIKE count COLLECT count
     * hash：COMMENT_PARENTCOMMENT+id LIKE count
     * hash：COMMENT_SONCOMMENT+id LIKE count
     * hash：STUDY_MATERIAL+id LIKE count COLLECT count
     * <p>
     * 根据帖子id取帖子的点赞量
     * 1. hash的操作对象
     * 2. get--》COMMENT_POST+id（key）
     * 3. hash对象，里面存储了所有帖子的点赞量或者收藏量
     * 4. 用帖子id在hash对象中取到点赞量
     */
    public static final String COMMENT_POST = "comment:post:";
    public static final String COMMENT_PARENTCOMMENT = "comment:parent_comment:";
    public static final String COMMENT_SONCOMMENT = "comment:son_comment:";
    public static final String STUDY_DATA = "study:data:";

    /**
     *查询帖子内容的key
     */
    public static final String COMMENT_POST_INFO = "comment:post:info:";
    public static final Long CACHE_NULL_TTL =2L;
    public static final Long COMMENT_INFO_TTL=30L;

    public static final String UV_KEY = "uv:count:";

    /**
     * 用户与评论/学习资料的点赞与收藏关系（用户作为key）
     * <p>
     * 查询用户是否点赞过
     * 1. set的操作对象
     * 2. get--》COMMENT_POST_USER_LIKE+userId（key）
     * 3. set对象，里面存储了该用户的所有点赞帖子
     * 4. 用帖子id在set对象中取到是否点赞过
     */
    public static final String COMMENT_POST_USER_LIKE = "comment:post:user:like:";
    public static final String COMMENT_POST_USER_COLLECT = "comment:post:user:collect:";
    public static final String COMMENT_PARENTCOMMENT_USER_LIKE = "comment:parent_comment:user:like:";
    public static final String COMMENT_SONCOMMENT_USER_LIKE = "comment:son_comment:user:like:";
    public static final String STUDY_DATA_USER_LIKE = "study:data:user:like:";
    public static final String STUDY_DATA_USER_COLLECT = "study:data:user:collect:";
    /**
     * 帖子、评论列表与详情
     */
//TODO
//==========================分隔线==============================
    //分布式锁
    public static final String LOCK_SUFFIX = ":lock";

    //==========================分隔线==============================
    //时间
    public static final long KEY_TIMEOUT = 24 * 60 * 60;
    // 定义变量，记录空对象的缓存过期时间
    public static final long KEY_TEMPORARY_TIMEOUT = 10 * 60;

    //单位：秒 尝试获取锁的最大等待时间
    public static final long LOCK_EXPIRE_PX1 = 1;
    //单位：秒 锁的持有时间
    public static final long LOCK_EXPIRE_PX2 = 1;

    //活动报名名额
    public static final String ACTIVITY_NUMBER = "activity:number:";
}
